layui.define([ 'form', 'laydate', 'table'], function(exports) {
    var form = layui.form;
    var index = layui.index;
    var view = {
        init:function(){
        	  this.initSubmit();
        },
        initSubmit:function(){
        	 //取消订单
            $(document).on('click', '.order_cancel button.btn-ordercancel',function(){
                var orderId = $('input[name="pop-orderId"]').val();

                var reasonType = $('input[name="reasonType"]:checked').val();
                if(reasonType==7){
                    var reasonDesc = $('input[name="reasonDesc"]').val();
                }else{
                    var reasonDesc = $('input[name="reasonType"]:checked').parent().text();
                }

                $('.popup-btn-close').click();  //关闭
                var requestData={orderId:orderId, 
                		reasonType:reasonType,
                		reasonDesc:reasonDesc 
                		}
                doAjax("/order/orderInfo/updateOrderCancel.json", 'post', {'requestData':JSON.stringify(requestData)}, function(ret){
                	if(ret.code=='200'){
                        $.alert('success',"订单取消成功！");
                        location.href = location.href;
                    }
                });
                
            });
        }
            
    }
    exports('indexDetail',view);
	
});